[#638] Fix PLOT-mode MAX buy path and remove unnecessary delays#646
[#638] Fix PLOT-mode MAX buy path and remove unnecessary delays#646realproject7 merged 3 commits intomainfrom
Conversation
- handleBuyMax: skip getZapQuote in PLOT mode; binary-search getReserveForToken to find max mintable storyline tokens - DonateWidget: remove 5s setTimeout (unnecessary on Base mainnet) - usePublish: remove 5s setTimeout (unnecessary on Base mainnet) Fixes #638 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Addresses T2b review feedback: the original binary search made up to 64 sequential RPC calls (~3-12s). Now uses multicall to batch probes: 1. Exponential search (1 multicall, 20 probes) finds the magnitude 2. Two rounds of 16-point linear probes (2 multicalls) narrow to answer Total: 3 RPC round-trips instead of up to 64. Also fixes upper-bound issue: exponential probing correctly handles early-curve positions where tokens cost far less than 1 PLOT each. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The PR fixes the silent PLOT-mode failure and removes the artificial waits, but the new PLOT MAX path still does not reliably compute the actual maximum buyable amount.
Findings
- [high] The binary-search upper bound assumes
1 storyline token <= 1 PLOT, which is not guaranteed by the bonding curve.- File:
src/components/TradingWidget.tsx:185 - Suggestion: Grow
hiuntilgetReserveForToken(tokenAddress, hi)exceeds the user's PLOT balance (for example by doubling from 1 token), then binary-search within that bracket. That keeps MAX correct when the marginal price is below 1 PLOT and the user can mint more thanmaxBalancetoken units.
- File:
Decision
Requesting changes because the current implementation can still underfill MAX buys in PLOT mode, so it does not meet the acceptance criterion that MAX works correctly.
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The revised multicall search fixes the earlier upper-bound / round-trip issues, but the PLOT-mode MAX path still misses a valid buy range below one full token.
Findings
- [high] The probe ladder starts at
1e18and returns early when that first whole-token probe is too expensive, so MAX still does nothing for wallets that can afford only a fractional token.- File:
src/components/TradingWidget.tsx:188 - Suggestion: Include sub-1-token probes (for example
1e17,1e16, ...), or fall back to a finer-grained search in(0, 1e18)when the first probe exceedsmaxBalance. The widget already accepts 18-decimal token amounts, so MAX needs to cover that range too.
- File:
Decision
Requesting changes because users who can buy less than one storyline token still get a broken MAX button, which does not satisfy the acceptance criterion that MAX works correctly in PLOT mode.
Exponential search now starts from 1e12 (0.000001 tokens) instead of 1e18 (1 whole token), so MAX works for wallets that can only afford a fractional storyline token on the bonding curve. Addresses T2a review: previous code no-oped when 1 whole token exceeded the user's PLOT balance. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The requested fixes are addressed. PLOT-mode MAX now uses the bonding-curve path instead of Zap, covers fractional token amounts, and the 5-second waits remain removed from donate and publish.
Findings
- None.
Decision
Approving on code review. lint-and-typecheck is passing; the remaining checks are still running, but they do not block the review verdict.
Summary
handleBuyMaxno longer callsgetZapQuote()in PLOT mode (which silently failed). Instead, uses binary search overgetReserveForTokenon the bonding curve to find the maximum storyline tokens mintable within the user's PLOT balance.setTimeoutdelay before indexer call — unnecessary on Base mainnet.setTimeoutdelay before indexer call — unnecessary on Base mainnet.Fixes #638
Tracks realproject7/agent-os#309
Test plan
🤖 Generated with Claude Code